package com.example.superoa.model.pojos;

import java.io.Serializable;
import javax.persistence.*;
import java.util.List;


/**
 * The persistent class for the department database table.
 * 
 */
@Entity
@NamedQuery(name="Department.findAll", query="SELECT d FROM Department d")
public class Department implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	private Integer depart_id;

	@Column(name="depart_address")
	private String departAddress;

	@Column(name="depart_name")
	private String departName;
	
	@Column(name="depart_parentsid")
	private String depart_parentsid;
	
	@Column(name="staffid")
	private Integer staffId;

	//bi-directional many-to-many association to Position
	@ManyToMany(mappedBy="departments")
	private List<Position> positions;

	//bi-directional many-to-one association to PositionDepartment

	//bi-directional many-to-one association to Rplan
	@OneToMany(mappedBy="department")
	private List<Rplan> rplans;

	//bi-directional many-to-one association to Staff
	@OneToMany(mappedBy="department")
	private List<Staff> staffs;

	//bi-directional many-to-one association to TransferJl
	@OneToMany(mappedBy="department")
	private List<TransferJl> transferJls;

	public Department() {
	}

	public Integer getDepart_id() {
		return this.depart_id;
	}

	public void setDepart_id(Integer depart_id) {
		this.depart_id = depart_id;
	}

	public String getDepartAddress() {
		return this.departAddress;
	}

	public void setDepartAddress(String departAddress) {
		this.departAddress = departAddress;
	}

	public String getDepartName() {
		return this.departName;
	}

	public Integer getStaffId() {
		return staffId;
	}

	public void setStaffId(Integer staffId) {
		this.staffId = staffId;
	}

	public void setDepartName(String departName) {
		this.departName = departName;
	}
	
	public String getDepart_parentsid() {
		return this.depart_parentsid;
	}

	public void setDepart_parentsid(String depart_parentsid) {
		this.depart_parentsid = depart_parentsid;
	}

	public List<Position> getPositions() {
		return this.positions;
	}

	public void setPositions(List<Position> positions) {
		this.positions = positions;
	}



	public List<Rplan> getRplans() {
		return this.rplans;
	}

	public void setRplans(List<Rplan> rplans) {
		this.rplans = rplans;
	}

	public Rplan addRplan(Rplan rplan) {
		getRplans().add(rplan);
		rplan.setDepartment(this);

		return rplan;
	}

	public Rplan removeRplan(Rplan rplan) {
		getRplans().remove(rplan);
		rplan.setDepartment(null);

		return rplan;
	}

	public List<Staff> getStaffs() {
		return this.staffs;
	}

	public void setStaffs(List<Staff> staffs) {
		this.staffs = staffs;
	}

	public Staff addStaff(Staff staff) {
		getStaffs().add(staff);
		staff.setDepartment(this);

		return staff;
	}

	public Staff removeStaff(Staff staff) {
		getStaffs().remove(staff);
		staff.setDepartment(null);

		return staff;
	}

	public List<TransferJl> getTransferJls() {
		return this.transferJls;
	}

	public void setTransferJls(List<TransferJl> transferJls) {
		this.transferJls = transferJls;
	}

	public TransferJl addTransferJl(TransferJl transferJl) {
		getTransferJls().add(transferJl);
		transferJl.setDepartment(this);

		return transferJl;
	}

	public TransferJl removeTransferJl(TransferJl transferJl) {
		getTransferJls().remove(transferJl);
		transferJl.setDepartment(null);

		return transferJl;
	}

}